#ifndef ACAPELLA_SERIALIZE_SERIALIZE_STRATEGY
#define ACAPELLA_SERIALIZE_SERIALIZE_STRATEGY

#include <acapella/traits/traits.h>

namespace acapella
{
namespace serialize
{


template<typename is_pod>
struct serialize_strategy
{
};

template<>
struct serialize_strategy<traits::true_type>
{
    template<typename T, typename StreamType>
    static bool write(const T& value, StreamType& st)
    {
		st.write((const char*)&value, sizeof(T));
        return st.good();
    }

    template<typename T, typename StreamType>
    static bool read(T& value, StreamType& st)
    {
		st.read((char*)&value, sizeof(T));
        return st.good();
    }
};

template<>
struct serialize_strategy<traits::false_type>
{
    template<typename T, typename StreamType>
    static bool write(const T& value, StreamType& st)
    {
        return value.serialize(st);
    }

    template<typename T, typename StreamType>
    static bool read(T& value, StreamType& st)
    {
        return value.unserialize(st);
    }
};


}
}




#endif
